import { defineAsyncComponent } from "vue";
import type { App } from "vue";

const components: Record<string, () => Promise<unknown>> = import.meta.glob("./lib/*/*.vue");

export default function install(app: App): void {
    for (const [key, value] of Object.entries(components)) {
        const name: string = key.split("/")[1];
        app.component(name, defineAsyncComponent(value as any));
    }
}
